#ifndef BASE_SYSTEM_LOG_IO_INCLUDE_IO_MANAGER_H
#define BASE_SYSTEM_LOG_IO_INCLUDE_IO_MANAGER_H

#include <memory>
#include <mutex>
#include <vector>
#include "i_output_strategy.h"

namespace Base {
namespace SystemLog {
class IOManager {
public:
    ErrCode AddStrategy(OutputStrategyPtr strategy);

    ErrCode Write(const char* data, size_t len);
    ErrCode Flush();
    ErrCode Close();
    
    /**
     * 强制同步所有输出策略
     * 对于支持ForceSync的策略（如FileOutputStrategy），调用其ForceSync方法
     */
    ErrCode ForceSync();
    
    size_t GetStrategyCount() const {
        return strategies_.size();
    }

private:
    std::vector<OutputStrategyPtr> strategies_;
    mutable std::mutex mutex_;
};
} // namespace SystemLog
} // namespace Base

#endif // BASE_SYSTEM_LOG_IO_INCLUDE_IO_MANAGER_H